package chepter06.example02;

import java.util.ArrayList;
import java.util.LinkedList;

public class Example02 {
    public static void main(String[] args) {
        LinkedList List = new LinkedList();
        List.add("张三");//向列表中添加String对象
        List.add("李四");
        List.add("王五");
        List.add("赵六");
        System.out.println("list元素个数:"+ List.size());
        System.out.println("查看第二个元素"+ List.get(1));
        System.out.println(List);
        List.set(2,"隔壁老王");//替换指定元素
        System.out.println(List);
        List.remove(2);
        System.out.println(List);
        List.add(Math.PI);//列表放入其他对象
        System.out.println(List);
    }
    }

